package com.atguigu.srb.core.controller.api;


import com.atguigu.srb.common.result.R;
import com.atguigu.srb.core.entity.vo.BorrowerVo;
import com.atguigu.srb.core.service.BorrowerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 借款人 前端控制器
 * </p>
 *
 * @author Atguigu
 * @since 2023-06-30
 */
@RestController
@RequestMapping("/api/core/borrower")
@Api(tags = "借款人模块")
public class ApiBorrowerController {
    @Resource
    BorrowerService borrowerService;
    @ApiOperation("借款人提交数据")
    @PostMapping("/auth/data")
    public R processData(@RequestBody BorrowerVo borrowerVo,
                         @RequestHeader("token")String token){
        borrowerService.processData(token,borrowerVo);
        return R.ok();
    }
    //获取借款人的审批状态
    @ApiOperation("查询借款人的申请状态")
    ///api/core/borrower/auth/status
    @GetMapping("/auth/status")
    public R getStatus(@RequestHeader("token")String token){
        Integer status = borrowerService.getStatus(token);
        return R.ok().data("status",status);
    }
}

